package com.bq;

public class NumberUtils {
    //判断字符串参数是否为数字
    public static boolean isNumber(String str){
        if(str !=null && !str.equals("")){
            String reg_letter="\\d+";
            return str.matches(reg_letter);
        }else{
            return false;
        }
    }
    //判断字符串参数是否全为实数(正负整数和小数,百分数)
    public static boolean isShishu(String str){
        if(str!=null && !str.equals("")){
            String reg_letter="^(\\-|\\+)?\\d+(\\.\\d+)?(%)?$";
            return str.matches(reg_letter);
        }else{
            return false;
        }
    }
    public static void main(String[] args){
        System.out.println(isShishu("+123.555"));
        System.out.println(isNumber("884654222"));
    }
}
